
import { mapRoomDomain } from "./map";

export const globalController={
    do(){
        // console.log(JSON.stringify(Memory,null,'\t'));//printJsonGroups
        
        for(let roomName in Game.rooms){
            let room = Game.rooms[roomName];
            if(!room){
                // Memory.rooms[roomName].exploring=false;
                continue;
            }
            if(room.controller && room.controller.my){
                mapRoomDomain(room);
            }
        }
        console.log('*** Code updated');
        // console.log(JSON.stringify(new StructureMap(new RoomPosition(0,0,'W7N3'))));
        // let store = Game.spawns.Spawn1.store;
        // for(let name in store){
        //     console.log(name, store[name]);
        // }
        // console.log(JSON.stringify(structureClusterTemplates.core))
    },
    run(){
        if(!global.done){
            try{
                this.do();
            }catch(e){
                console.log(e);
            }
            global.done=true;
        }
        return OK;
    }
}//W85S4